
<% add_decidim_page_title(t(".title")) %>
<div class="item_show__header border-none">
  <div class="w-full">
    <h1 class="item_show__header-title">
      <%= t(".title") %>
      <%= link_to t("actions.back", scope: "decidim.forms.admin.questionnaires"), survey_responses_path, class: "button button__sm button__secondary new" %>
    </h1>
  </div>
</div>

<p class="mt-2 text-gray-600">
  <%= t(".description") %>
</p>

<hr class="border-b border-t-0 border-gray mb-8 pb-4">

<div class="item__edit item__edit-1col">
  <div class="item__edit-form">
    <ol class="list-decimal list-inside">
      <% @survey.questionnaire.questions.each do |question| %>
        <% next if question.question_type == "separator" %>
        <% next if question.question_type == "title_and_description" %>

        <li class="<%= "text-gray" unless question_response_is_publicable(question.question_type) %> mb-6">
          <div class="inline">
            <span><%= translated_attribute question.body %> (<%= I18n.t("decidim.surveys.admin.publish_responses.index.responses", count: question.responses.count) %>)</span>

            <% if question_response_is_publicable(question.question_type) %>
              <%= render partial: "toggle_button", locals: { question: } %>
            <% end %>
          </div>

          <% if question_response_is_publicable(question.question_type) %>
            <div class="m-4">
              <%= chart_for_question(question.id) %>
            </div>
          <% end %>
        </li>
      <% end %>
    </ol>
  </div>
</div>

<%= append_javascript_pack_tag "decidim_forms_admin" %>
